<template>
  <div class="navbar">
    <div
      :class="{ active: '/' + item.path == $route.path }"
      class="box"
      v-for="(item, index) in list"
      :key="index"
      @click="topage(item.path)"
    >
      <img
        :src="
          '/' + item.path == $route.path ? item.meta.icon_act : item.meta.icon
        "
        alt=""
      />
      {{ item.meta.title }}
    </div>
  </div>
</template>

<script>
export default {
  computed: {
    list() {
      return this.$router.options.routes[1].children.filter(
        (item) => !item.meta.hidden
      );
    },
  },
  methods: {
    topage(url) {
      this.$router.push(url);
    },
  },
};
</script>

<style lang="scss" scoped>
.navbar {
  width: 100vw;
  height: 120px;
  display: flex;
  background-color: #999999;
  position: fixed;
  bottom: 0;
  div {
    flex: 1;
    text-align: center;
    img {
      width: 70px;
      display: block;
      margin: 0 auto;
      margin-top: 5px;
    }
  }
}
.active{
    color: #ccc;
}
</style>